package com.cqupt.tr.edgenode.component;



import com.cqupt.tr.edgenode.utils.RedisUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class Redisconfig {

    //读取配置文件中的redis的ip地址
//    @Value("${spring.redis.host:disabled}"172.23.13.213)
    private String host ="127.0.0.1";


//   @Value("${spring.redis.port:0}")
    private int port =6379;

//    @Value("${spring.redis.database:0}")
    private int database =0;

    @Bean
    public RedisUtils getRedisUtil(){
        if(host.equals("disabled")){
            return null;
        }
        RedisUtils redisUtil=new RedisUtils();
        redisUtil.initPool(host,port,database);
        return redisUtil;
    }







}
